package com.mm.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class DateUtil {

    /**
     * 判断两个时间相差几分钟
     * @param oldTime
     * @param newTime
     * @return
     * @throws ParseException
     */
    public long dateDifference(String oldTime,String newTime) throws ParseException {

        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long NTime =df.parse(newTime).getTime();
        //从对象中拿到时间
        long OTime = df.parse(oldTime).getTime();
        long diff=(NTime-OTime)/1000/60;
        return diff;
    }

}
